<template>
  <h1>一个人的信息</h1>
  <h2>姓名：{{ person.name }}</h2>
  <h2>年龄：{{ person.age }}</h2>
  <button @click="test">测试触发一下Demo组件的showMsg事件</button>
</template>

<script>
import { reactive } from "vue";
export default {
  name: "App",
  // props: ["msg", "school"],
  // emits: ["showMsg"],
  beforeCreate() {
    console.log("-------beforeCreate-------");
  },
  setup(props, context) {
    console.log("-------setup-------", props);
    console.log(context, context.attrs, context.slots);
    let person = reactive({
      name: "张三",
      age: 18,
    });

    function test() {
      context.emit("showMsg", 999);
    }

    return {
      person,
      test,
    };
  },
};
</script>
